static-lib=libmymath.a
dong-lib=libmyfunc.so

.PHONY:all
all:$(static-lib) $(dong-lib)

$(static-lib):mymath.o
	ar -rc $@ $^
mymath.o:mymath.c
	gcc -c $^

$(dong-lib):mylog.o myprintf.o
	gcc -o $@ $^ -shared
mylog.o:mylog.c
	gcc -fPIC -c $^
myprintf.o:myprintf.c
	gcc -fPIC -c $^

.PHONY:clean
clean:
	rm -rf *.o *.a *.so lib

.PHONY:output
output:
	mkdir -p lib/include
	mkdir -p lib/mylib
	cp *.h lib/include
	cp *.a lib/mylib
	cp *.so lib/mylib
